//
//  SecongViewController.m
//  testSwift
//
//  Created by taoge on 2018/3/20.
//  Copyright © 2018年 FT. All rights reserved.
//

#import "SecongViewController.h"
#import "HeaderPch.h"
@interface SecongViewController ()<UITableViewDelegate,UITableViewDataSource,DelegateTool>
@property(nonatomic, strong) UITableView * tableView;
@property(nonatomic, strong) FTTableViewCell * myCell;
@property(nonatomic, strong) FTView * ftView;
@property(nonatomic, strong) TestView * testView;
@end

@implementation SecongViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.tableView];
    
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.backgroundColor = [UIColor redColor];
    btn.frame = CGRectMake(100, 200, 100, 30);
    [btn addTarget:self action:@selector(clickbtn) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
//    [self.view addSubview:self.ftView];
    [self.view addSubview:self.testView];
    
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 150;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    FTTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"FTTableViewCell"];
    if (cell == nil) {
        cell=[[[NSBundle mainBundle]loadNibNamed:@"FTTableViewCell" owner:self options:nil]lastObject];
    }
    cell.titleLable.text = @"0007";
    return cell;
}

-(void)clickbtn{
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(UITableView*)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
        _tableView.backgroundColor = [UIColor orangeColor];
        _tableView.delegate = self;
        _tableView.dataSource = self;
    }
    return _tableView;
}
-(void)clickButtonAction:(UIButton*)sender{
    NSLog(@"-=-=-=-=-=-=--");
}

-(FTView*)ftView{
    if (!_ftView) {
        _ftView = [[UINib nibWithNibName:@"FTView" bundle:nil] instantiateWithOwner:nil options:nil].firstObject;
        _ftView.frame = CGRectMake(100, 100, 200, 100);
        _ftView.myLable.text = @"099090";
    }
    return _ftView;
}
-(TestView*)testView{
    if (!_testView) {
        _testView = [[TestView alloc]initWithFrame:CGRectMake(200, 200, 300, 260)];
        _testView.backgroundColor = [UIColor cyanColor];
     }
    return  _testView;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
